<?php

      /*加载初始化文件*/
      // include('init.php');
      //
      //
        /*如果用户提交，则$_POST值不为空*/
        if(!empty($_POST)){




            /*<--将提交上来的数据存储到数据库-->*/
            $username = $_POST['username'];
            $password = $_POST['password'];
            $sex = $_POST['sex'];
            $age = $_POST['age'];
            $birthday = $_POST['birthday'];
            $address = $_POST['address'];
            $position = $_POST['position'];


            /*编写sql  insert语句*/
            $sql = "insert into `test`.`admin` (`username`,`password`,`sex`,`age`,`birthday`,`address`,`position`) values ('$username',md5('$password'),'$sex','$age','$birthday','$address','$position')";




            /*执行sql语句*/
            mysqli_query($link,$sql);

            /*获取sql执行后，影响的行数*/
            $math = mysqli_affected_rows($link);


           echo ($math>0)?" <script> alert('添加成功');location.href='index.php?c=admin&&a=list&&admin=1';</script>":" <script> alert('添加失败');history.go(-1);</script>";
        }


      /*加载视图*/

      include(CON_VIEW.'admin/common.html');




?>